//
//  UISearchBar+Style.m
//  duzhoumo
//
//  Created by 度周末网络-王腾 on 15/11/23.
//  Copyright © 2015年 dzmmac. All rights reserved.
//

#import "UISearchBar+Style.h"
#import "UIScreen+Frame.h"
@implementation UISearchBar (Style)

-(void)dzmStyle{
    UITextField *searchField = [self valueForKey:@"_searchField"];
    searchField.tintColor = [UIColor whiteColor];
    self.tintColor = [UIColor whiteColor];
    searchField.textColor = [UIColor whiteColor];
    UIButton *clearButton = [searchField valueForKey:@"_clearButton"];
    [clearButton setImage:[UIImage imageNamed:@"searchbar_cancelbtn"] forState:UIControlStateNormal];
    UIImageView *leftImg = [[UIImageView alloc ] initWithFrame:CGRectMake(0, 0, 15, 15)];
    leftImg.image = [UIImage imageNamed:@"ion_search_spell"];
    searchField.leftView = leftImg;
    [searchField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    [self setSearchFieldBackgroundImage:[UIImage imageNamed:@"img_bg_search"] forState:UIControlStateNormal];
}

+(void)confiySarchBar:(UISearchBar *)searchBar{
    UITextField *searchField = [searchBar valueForKey:@"_searchField"];
    searchField.tintColor = [UIColor whiteColor];
    searchBar.tintColor = [UIColor whiteColor];
    searchField.textColor = [UIColor whiteColor];
    UIButton *clearButton = [searchField valueForKey:@"_clearButton"];
    [clearButton setImage:[UIImage imageNamed:@"searchbar_cancelbtn"] forState:UIControlStateNormal];
    UIImageView *leftImg = [[UIImageView alloc ] initWithFrame:CGRectMake(0, 0, 15, 15)];
    leftImg.image = [UIImage imageNamed:@"ion_search_spell"];
    searchField.leftView = leftImg;
    [searchField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    [searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"img_bg_search"] forState:UIControlStateNormal];
}

@end
